{% extends "base_petadmin.html" %}

{% block mainheading %}Futures track list for {{ selected_date|date:"Y-m" }} {% endblock %}

{% block content %}

{% include "tracking/_links.html" with month_year_link=month_year_link %}

<table>
{% for week in month %}

    {% if week.monday != 0 %}
        {% for tr in week.get_futures_tracks_for_monday %}
            <tr class="row1">
                {% include "tracking/_futures_tr.html" with tr=tr %}
            </tr>
        {% empty %}
            <tr class="row1">
                <td>&nbsp;</td>
                <td style="color: darkgray;" nowrap>{{ week.get_date_for_monday|date:"d" }}, Mon</td>
                <td colspan="16" style="color: darkgray;">No tracks</td>
            </tr>
        {% endfor %}
    {% else %}
        {# Previous or next month #}
    {% endif %}

    {% if week.tuesday != 0 %}
        {% for tr in week.get_futures_tracks_for_tuesday %}
            <tr class="row2">
                {% include "tracking/_futures_tr.html" with tr=tr %}
            </tr>
        {% empty %}
            <tr class="row2">
                <td>&nbsp;</td>
                <td style="color: darkgray;">{{ week.get_date_for_tuesday|date:"d" }}, Tue</td>
                <td colspan="16" style="color: darkgray;">No tracks</td>
            </tr>
        {% endfor %}
    {% else %}
        {# Previous or next month #}
    {% endif %}
    
    {% if week.wednesday != 0 %}
        {% for tr in week.get_futures_tracks_for_wednesday %}
            <tr class="row1">
                {% include "tracking/_futures_tr.html" with tr=tr %}
            </tr>
        {% empty %}
            <tr class="row1">
                <td>&nbsp;</td>
                <td style="color: darkgray;">{{ week.get_date_for_wednesday|date:"d" }}, Wed</td>
                <td colspan="16" style="color: darkgray;">No tracks</td>
            </tr>
        {% endfor %}
    {% else %}
        {# Previous or next month #}
    {% endif %}

    {% if week.thursday != 0 %}
        {% for tr in week.get_futures_tracks_for_thursday %}
            <tr class="row2">
                {% include "tracking/_futures_tr.html" with tr=tr %}
            </tr>
        {% empty %}
            <tr class="row2">
                <td>&nbsp;</td>
                <td style="color: darkgray;">{{ week.get_date_for_thursday|date:"d" }}, Thu</td>
                <td colspan="16" style="color: darkgray;">No tracks</td>
            </tr>
        {% endfor %}
    {% else %}
        {# Previous or next month #}
    {% endif %}

    {% if week.friday != 0 %}
        {% for tr in week.get_futures_tracks_for_friday %}
            <tr class="row1">
                {% include "tracking/_futures_tr.html" with tr=tr %}
            </tr>
        {% empty %}
            <tr class="row1">
                <td>&nbsp;</td>
                <td style="color: darkgray;">{{ week.get_date_for_friday|date:"d" }}, Fri</td>
                <td colspan="16" style="color: darkgray;">No tracks</td>
            </tr>
        {% endfor %}
    {% else %}
        {# Previous or next month #}
    {% endif %}

    {% if week.saturday != 0 %}
        {% for tr in week.get_futures_tracks_for_saturday %}
            <tr class="row2">
                {% include "tracking/_futures_tr.html" with tr=tr %}
            </tr>
        {% empty %}
            <tr class="row2">
                <td style="color: red;">&nbsp;</td>
                <td style="color: red;">{{ week.get_date_for_saturday|date:"d" }}, Sat</td>
                <td colspan="16"></td>
            </tr>
        {% endfor %}
    {% else %}
        {# Previous or next month #}
    {% endif %}
    
    {% if week.sunday != 0 %}
        {% for tr in week.get_futures_tracks_for_sunday %}
            <tr class="row1">
                {% include "tracking/_futures_tr.html" with tr=tr %}
            </tr>
        {% empty %}
            <tr class="row1">
                <td style="color: red;">&nbsp;</td>
                <td style="color: red;">{{ week.get_date_for_sunday|date:"d" }}, Sun</td>
                <td colspan="16"></td>
            </tr>
        {% endfor %}
    {% else %}
        {# Previous or next month #}
    {% endif %}

    <tr>
        <td colspan="18" style="border-top: solid 1px black;">&nbsp;</td>
    </tr>

{% endfor %}
</table>

{% endblock %}
